import request from '@/utils/request'
import qs from "qs";

export function add(data) {
  return request({
    url: 'api/jobs',
    method: 'post',
    data
  })
}

// 查询用户列表
export function listQuartzJobs(query) {
  return request({
    url: '/api/jobs'+ '?' + qs.stringify(query, { indices: false }),
    method: 'get',
  })
}


export function del(id) {
  return request({
    url: 'api/jobs/'+id,
    method: 'delete'
  })
}

export function delIds(ids) {
  return request({
    url: 'api/jobs/'+ids,
    method: 'delete'
  })
}

export function edit(data) {
  return request({
    url: 'api/jobs',
    method: 'put',
    data
  })
}

export function updateIsPause(id) {
  return request({
    url: 'api/jobs/updateIsPause/' + id,
    method: 'put'
  })
}

export function execution(id) {
  return request({
    url: 'api/jobs/exec/' + id,
    method: 'put'
  })
}

// 根据id查询定时任务调度详细
export function getJob(jobId) {
  return request({
    url: '/api/jobs/' + jobId,
    method: 'get'
  })
}


export default { listQuartzJobs,del,delIds, updateIsPause, execution, add, edit,getJob }
